package bobsays;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import bob.BobSays;
import say.SayHello;

public class Activator implements BundleActivator {

	private ServiceRegistration serviceReg = null;
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		  serviceReg = context.registerService(SayHello.class.getName(),
	                new BobSays(), null);// 1
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		 if (serviceReg != null)
	            serviceReg.unregister();// 2
	}

}
